package commands;

import IA.InformationAggregator;

/**
 *
 * @author Christopher
 */
public class CmdAddItem extends Command {
    private String itemStr;

    public CmdAddItem(InformationAggregator ia, String itemStr){
        super(ia);
        this.itemStr = itemStr;
    }
    @Override
    public Object execute() {
        String name, description;
        Double basePrice;
        Integer dishesAvailable, prepTime;
        String delimiter = "/";
        String[] ary;
        
        ary = itemStr.split(delimiter);
        name = ary[0];
        description = ary[1];
        basePrice = Double.parseDouble(ary[2]);
        dishesAvailable = Integer.parseInt(ary[3]);
        prepTime = Integer.parseInt(ary[4]);
        ia.getMenu().addItem(name, description, basePrice, dishesAvailable, 
                prepTime);
        return null;
    }
    
}
